<?php
//5.3.10
header('Content-type: text/html; charset=utf-8');

if(isset($_GET['info'])){
  die(phpinfo());
}

require_once('./lib/base.inc');
require_once(PATH_CLASS.'debug.class.php');
require_once(PATH_CLASS.'commun.class.php');

//commun::addNotif("Une <a href=\"#\">chaine qu'elle est longue</a>, comment tu vas t'en sortir hein?");

if(commun::doAutoLogin()==true){
  //On vient de se logger;
  commun::setSmartyCaching(false);
  
}

if(isset($_GET['no-cache'])){
	if($_GET['no-cache']=='true'){
	    $_SESSION['no-cache']=true;
	}
	else
	    unset($_SESSION['no-cache']);
}

if(isset($_SESSION['no-cache'])){
	header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");               // Date du passé
	header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");  // toujours modifié
	header("Cache-Control: no-cache, must-revalidate");             // HTTP/1.1
	header("Pragma: no-cache");
}

$sql='select * from t_params';

$db->Select($sql);
while($row=$db->Next())
	$param[$row['param_name']]=$row['param_value'];

$smarty->assign('param',$param);

$_sGET="";
foreach($_GET as $key=>$val)
	$_sGET .='&'.$key.'='.$val; 

$smarty->assign(array(
	'PHP_EXT' 		=> PHP_EXT,
	'__page' 		=> $__page,
	'_URL'			=> getUrl(),
	'_URL_NO_GET'	=> getUrl("",false),
	'_URL_PATH'		=> dirname(getUrl("",false)),
	'_GET'			=> $_GET,
	'_sGET'			=> $_sGET,
	'_POST'			=> $_POST,
	'_INDEX_PAGE'	=> INDEX_PAGE,
	'_SITE_URL'		=> commun::getSiteUrl(),
));

$saison_courante = $db->SelectFirst('select * from t_saisons where saison_courante=1 order by saison_id desc LIMIT 1;');
$smarty->assign('saison_courante',$saison_courante);
$smarty->assign('saison_courante_id',$saison_courante['saison_id']);
$smarty->assign('_SESSION',$_SESSION);


//$filename = PATH_CODE.'site_'.$__page.'.'.PHP_EXT;
//if(file_exists($filename)){
//  @include($filename);
//}

//if(isset($_GET['point'])){
//  $filename = PATH_CODE.$__page.'/site_'.$_GET['point'].'.'.PHP_EXT;
//  if(file_exists($filename)){
//    @include($filename);
//  }
//}

// Style par défaut du site
css::add(array(
  "themes/jquery-ui.override.css"
));

processBatch();
parseReport();
debug::render();
parseDocument();



//parseSpyReport();

if(isset($_GET['!phpinfo!'])){
    ob_clean();
	phpinfo();
}

//if(isset($_COOKIE['spyR']) && $_COOKIE['spyR']=='true'){
//	parseSpyReport();
//}


?>
